package com.example.microserviceeurekaorder.Controller;

import com.netflix.discovery.converters.Auto;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.client.RestTemplate;

/**
 * @author liuyulong
 * @create 2022-03-16 18:01
 * @create 2022-三月  星期三
 * @project Microservice-SpringCloud_work2_2022_3_16
 */
@RestController
public class ordController {

    @Autowired
    private RestTemplate restTemplate;

    @GetMapping("/buy/{num}")
    public String ToGet(@PathVariable String num) {
        String forObject = restTemplate.getForObject("http://mircoservice-eureka-product/product/" + num, String.class);
        return forObject;
    }
}
